package com.fit4as.fit
{

import flash.utils.getTimer;


public class RunTime
{

    private var start : int = getTimer();
    private var elapsed : int = 0;

    public function toString() : String {
        elapsed = (getTimer() - start);
        if (elapsed > 600000) {
            return d(3600000) + ":" + d(600000) + d(60000) + ":" + d(10000) + d(1000);
        } else {
            return d(60000) + ":" + d(10000) + d(1000) + "." + d(100) + d(10);
        }
    }

    private function d(scale : int) : String {
        var report : int = elapsed / scale;
        elapsed -= report * scale;
        return report.toString();
    }
}

}